package models

import (
	"gorm.io/gorm"
	"shop/database/mysql"
	add1 "shop/internal/models/address"
	coupon1 "shop/internal/models/coupon"
	goods1 "shop/internal/models/goods"
	order "shop/internal/models/order"
	user1 "shop/internal/models/user"
)

// 自动迁移
func AutoMigrate() error {
	return mysql.WithMysql(func(db *gorm.DB) error {
		return db.AutoMigrate(&coupon1.Coupon{}, &coupon1.PointsCoupon{}, &coupon1.Rule{},
			&goods1.Goods{}, &goods1.Types{}, &goods1.GoodsSku{}, &goods1.GoodsProperty{}, &goods1.GoodsPropertyValue{},
			&user1.User{},
			&add1.Address{},
			&order.Order{}, &order.OrderGoods{})
	})
}
